import React, { useEffect, useState } from "react"

const Err401 = () => {

    const [num, setNum] = useState(5)


    // 秒数倒计时
    setInterval(() => {
        setNum(num - 1)
    }, 1000)

    useEffect(() => {
        if (num <= 1) {
            // 跳转到首页
            window.location.href = '/'
        }
    }, [num])

    return <div>
        您无权访问此页面 {num}秒钟后自动跳转至首页
    </div>
}

export default Err401